package com.peace.hospital.mapper.drugstorage;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.peace.hospital.entity.drugstorage.Druginformationandwaentry;
import com.peace.hospital.entity.drugstorage.Waentry;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xie
 * @since 2019-11-18
 */
@Mapper
public interface DruginformationandwaentryMapper extends BaseMapper<Druginformationandwaentry> {
    @Insert("insert into drugstorage.druginformationandwaentry(drugid,waeid)\n" +
            "values(#{drugid},#{waeid})")
    public int addDruAndWa(int drugid, int waeid);
//查询druginformationandwaentry的信息
    @Select("select drugid from drugstorage.druginformationandwaentry where waeid=#{waeid}")
    @Results({
            @Result(column="drugid",property="druginformation",one=@One(select="com.peace.hospital.mapper.publicn.DruginformationMapper.selectById",fetchType= FetchType.LAZY))
    })
    public List<Druginformationandwaentry> selectById(Waentry waentry);
}
